#!/bin/bash

#Black        0;30     Dark Gray     1;30
#Red          0;31     Light Red     1;31
#Green        0;32     Light Green   1;32
#Brown/Orange 0;33     Yellow        1;33
#Blue         0;34     Light Blue    1;34
#Purple       0;35     Light Purple  1;35
#Cyan         0;36     Light Cyan    1;36
#Light Gray   0;37     White         1;37

ERROR_COLOR='\033[1;31m'
PRIMARY_COLOR='\033[1;34m'
COUNT_COLOR='\033[0;33m'
ACCENT_COLOR='\033[1;32m'
SUCCESS_COLOR='\033[1;33m'
NO_COLOR='\033[0m'

((i+=1));
printf "${PRIMARY_COLOR}Trying push: ${COUNT_COLOR}${PWD##*/} ${i}${ACCENT_COLOR}\n";
git push -u origin --all
flag=$?;
				
while [ $flag -ne 0 ]; do
	clear;
	((i+=1));
	printf "${PRIMARY_COLOR}Trying push: ${COUNT_COLOR}${PWD##*/} ${i}${ACCENT_COLOR}\n";
	git push -u origin --all
	flag=$?;
done
printf "${PRIMARY_COLOR}Push completed for: ${SUCCESS_COLOR}${PWD##*/}\n";

printf "${ERROR_COLOR}.\n";
printf "${ERROR_COLOR}.\n";
printf "${ERROR_COLOR}.\n";
exit